import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns
import matplotlib as mpl
import warnings
warnings.filterwarnings("ignore")
# Recover default matplotlib settings
mpl.rcParams.update(mpl.rcParamsDefault)

# num = np.random.normal(1,10,1000)
# sns.distplot(num)
# plt.show()
#
# sns.distplot(num,kde=True) # Histogram with a kernel density estimate (Density Curve)
# plt.show()
# #
# sns.distplot(num,kde=False) # Histogram without a kernel density estimate (Density Curve)
# plt.show()
# #####################################################################
housing = pd.read_csv("C:/Users/Lenovo/Desktop/机器学习课程/Data-Visualization-master/Seaborn/Datasets/housing.csv")
print(housing.head())
housing.hist(bins=40 , figsize=(20,20)) #Pandas Hist function
plt.show()

# Displaying multiple distplots using subplot function.
fig1 , axes = plt.subplots(nrows=3,ncols=3 , figsize = (20,20))
sns.distplot( housing["longitude"] , ax=axes[0, 0])
sns.distplot( housing["latitude"] ,  ax=axes[0, 1])
sns.distplot( housing["housing_median_age"] , ax=axes[0, 2])
sns.distplot( housing["total_rooms"], ax=axes[1, 0] )
sns.distplot( housing["population"] , ax=axes[1, 1] )
sns.distplot( housing["households"] , ax=axes[1, 2] )
sns.distplot( housing["median_income"] , ax=axes[2, 0])
sns.distplot( housing["median_house_value"], ax=axes[2, 1])
sns.distplot( housing["median_house_value"], ax=axes[2, 2])
plt.show()

# Displaying multiple distplots using subplot function.
fig1 , axes = plt.subplots(nrows=3,ncols=3 , figsize = (20,20))
sns.distplot( housing["longitude"] , color="#00bcd4", ax=axes[0, 0] , kde=False , bins=20)
sns.distplot( housing["latitude"] , color="#937d14", ax=axes[0, 1] , kde=False,bins=20)
sns.distplot( housing["housing_median_age"] , color="#006600", ax=axes[0, 2],kde=False,bins=20)
sns.distplot( housing["total_rooms"] , color="#ff1e56", ax=axes[1, 0] , kde=False,bins=20)
sns.distplot( housing["population"] , color="#216353", ax=axes[1, 1] , kde=False,bins=20)
sns.distplot( housing["households"] , color="#FF8F00", ax=axes[1, 2] , kde=False,bins=20)
sns.distplot( housing["median_income"] , color="#33FF00", ax=axes[2, 0] , kde=False,bins=20)
sns.distplot( housing["median_house_value"] , color="#FF3300", ax=axes[2, 1], kde=False,bins=20)
sns.distplot( housing["median_house_value"] , color="#CCCC00", ax=axes[2, 2] , kde=False,bins=20)
plt.show()









